package fr.grassaud.hmvc.vaadin;

import com.vaadin.Application;
import com.vaadin.ui.Window;

import fr.grassaud.hmvc.session.HMVCSessionFactory;
import fr.grassaud.hmvc.session.HMVCSession;
import fr.grassaud.hmvc.vaadin.home.HomeView;
import fr.grassaud.hmvc.web.session.HMVCSessionFactoryLoader;

public class HmvcApplication extends Application {

    @Override
    public void init() {

	
	
	
	HMVCSessionFactory factory = HMVCSessionFactoryLoader.getCurrentHMVCSessionFactory();
	HMVCSession session = factory.newSession();
	HomeView view = session.getMainView();

	Window mainWindow = new Window("test");
	mainWindow.addComponent(view);
	setMainWindow(mainWindow);
    }

//    private ApplicationContext getSpringContext() {
//	WebApplicationContext wAppCtx = (WebApplicationContext) getContext();
//	ServletContext servletContext = wAppCtx.getHttpSession().getServletContext();
//	return WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
//    }

}
